package light.head.model;

import java.io.Serializable;
import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;

import org.hibernate.annotations.Formula;


/**
 * 请假记录表
 */
@Entity
@Table
public class Leave implements Serializable{

	private static final long serialVersionUID = -2582607393136372318L;
	
	private Integer code;
	private Integer uc;				//用户编号
	private Date start;				//请假开始日期
	private Date end;				//请假结束日期
	private String reason;			//原因
	private Integer cu;				//创建人
	private Date ct;				//创建时间
	private String agree;			//同意人
	private Boolean deleted;		//是否删除
	
	
	//@Formula
	private String cuname;			//创建者姓名
	private String username;		//用户编号
	
	
	@Id
	@GeneratedValue(strategy = GenerationType.IDENTITY)
	@Column
	public Integer getCode() {
		return code;
	}
	@Column
	public Integer getUc() {
		return uc;
	}
	@Column
	public Date getStart() {
		return start;
	}
	@Column
	public Date getEnd() {
		return end;
	}
	@Column
	public String getReason() {
		return reason;
	}
	@Column
	public Integer getCu() {
		return cu;
	}
	@Column
	public Date getCt() {
		return ct;
	}
	@Column
	public String getAgree() {
		return agree;
	}
	@Column
	public Boolean getDeleted() {
		return deleted;
	}
	@Formula("(SELECT u.realName FROM UserInfo u WHERE u.code = cu)")
	public String getCuname() {
		return cuname;
	}
	@Formula("(SELECT u.realName FROM UserInfo u WHERE u.code = user)")
	public String getUsername() {
		return username;
	}

	
	
	
	
	
	
	public void setCuname(String cuname) {
		this.cuname = cuname;
	}

	public void setUsername(String username) {
		this.username = username;
	}

	public void setCode(Integer code) {
		this.code = code;
	}

	public void setUc(Integer uc) {
		this.uc = uc;
	}

	public void setStart(Date start) {
		this.start = start;
	}

	public void setEnd(Date end) {
		this.end = end;
	}

	public void setReason(String reason) {
		this.reason = reason;
	}

	public void setCu(Integer cu) {
		this.cu = cu;
	}

	public void setCt(Date ct) {
		this.ct = ct;
	}

	public void setAgree(String agree) {
		this.agree = agree;
	}

	public void setDeleted(Boolean deleted) {
		this.deleted = deleted;
	}
	

}
